//package com.jumi.microservice.service.logistics.express;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.jumi.microservice.common.file.Md5Utils;
//import com.jumi.microservice.common.utils.HttpClientUtils;
//import com.jumi.microservice.dto.logistics.LogisticsSearchRequest;
//import com.jumi.microservice.dto.logistics.LogisticsSearchResponse;
//import com.ymdd.api.sdk.client.DefaultYmddClient;
//import com.ymdd.api.sdk.request.AbstractRequest;
//import com.ymdd.api.sdk.request.trace.QueryTraceRequest;
//import com.ymdd.api.sdk.response.trace.QueryTraceResponse;
//import com.ymdd.api.sdk.result.trace.QueryTraceResult;
//import com.ymdd.api.sdk.vo.WaybillTrackListVo;
//import com.ymdd.api.sdk.vo.WaybillTrackVo;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author by mazhao
// * 百世快递
// * @Classname BestExpress
// * @Description TODO
// * @Date 2020/8/21 14:30
// */
//@Service
//public class YmddExpress extends ResponseController implements Express {
//
//    private static final Logger log = LoggerFactory.getLogger(YmddExpress.class);
//
//    private static String serverUrl = "https://open.yimidida.com/api/getway";
//    private static String appKey = "";
//    private static String appSecret = "";
//
//    @Override
//    public String expressCode() {
//        return "YMDD";
//    }
//
//    @Override
//    public LogisticsSearchResponse logisticsSearch(LogisticsSearchRequest request) {
//        log.debug("壹米滴答查询参数[{}]", JSON.toJSONString(request));
//        JSONArray jsonArr = null;
//        try {
//            DefaultYmddClient defaultYmddClient = new DefaultYmddClient(serverUrl,appKey,appSecret);
//            QueryTraceRequest queryTraceRequest = new QueryTraceRequest();
//            queryTraceRequest.setWayBillNo(request.getLogisticsNo());
//            //发送请求并接受返回
//            QueryTraceResponse queryTraceResponse = defaultYmddClient.execute(queryTraceRequest);
//            log.debug("请求返回结果[{}]",JSON.toJSONString(queryTraceResponse));
//            //处理返回结果
//            QueryTraceResult queryTraceResult =  queryTraceResponse.getResult();
//            List<WaybillTrackListVo> list = queryTraceResult.getDetail();
//            WaybillTrackListVo waybillTrackListVo = null;
//            if(list!=null&& !list.isEmpty()){
//                waybillTrackListVo = list.get(0);
//            }
//            jsonArr = JSON.parseArray(JSON.toJSONString(waybillTrackListVo));
//        } catch (Exception e) {
//            log.error("壹米滴答查询出错[{}]",e.getMessage());
//        }
//        LogisticsSearchResponse logisticsSearchResponse = checkResult(jsonArr,request);
//        return controller(logisticsSearchResponse,jsonArr,"description","operateTime");
//    }
//
//}
